#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>

void hdfunc(int sig);

int main()
{
	//signal( 2, hdfunc);	// unreliable signal
	//signal(15, hdfunc);

	signal(35, hdfunc);	// reliable signal
	signal(36, hdfunc);

	for(int ii=1; ii < 100; ii++)
	{
		printf("ii=%d\n", ii);
		sleep(1);
	}

	return 0;
}

void hdfunc(int sig)
{
	printf("sig=%d\n", sig);

	for(int jj=1; jj<=5; jj++)
	{
		printf("jj(%d)=%d\n", sig, jj);
		sleep(1);
	}
}
